#include <iostream>
#include <algorithm>

using namespace std;
typedef long long LL;
int n, m, k;
const int M = 1e4 + 10, N = 1e3 + 10;
struct node
{
	int a, b, c;
}e[M];
int fa[N];
bool cmp(node& x, node& y)
{
	return x.c < y.c;
}
int find(int x)
{
	return fa[x] == x ? x : find(fa[x]);
}
void kk()
{
	sort(e + 1, e + 1 + m, cmp);
	for (int i = 1; i <= n; i++) fa[i] = i;
	LL ret = 0;
	int cnt = 0;
	for (int i = 1; i <= m; i++)
	{
		int x = e[i].a, y = e[i].b, l = e[i].c;
		int fx = find(x), fy = find(y);
		if (fx == fy) continue;
		cnt++;
		ret += l;
		fa[fx] = fy;
		if (cnt == n - k) break;
	}
	if (cnt == n - k) cout << ret << endl;
	else cout << "No Answer" << endl;
}
int main()
{
	cin >> n >> m >> k;
	for (int i = 1; i <= m; i++)
		cin >> e[i].a >> e[i].b >> e[i].c;
	kk();

	return 0;
}